/*
 * Copyright(C) 2010 Luvina Software Company
 *
 * LoggingInterceptor.java, Oct 29, 2010 ntmhuong
 */
package net.luvina.manageuser.util;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * LoggingInterceptor
 * @author ntmhuong
 *
 */
public class LoggingInterceptor implements MethodInterceptor{

    /**
     * invoke
     */
    public Object invoke(MethodInvocation invocation) throws Throwable {
        final Log logger = LogFactory.getLog(LoggingInterceptor.class);

        logger.debug("Start : method " + invocation.getMethod().getName() + " of class[" + invocation.getThis().getClass().getName() + "]");
        Object ret = invocation.proceed();
        logger.debug("End : method " + invocation.getMethod().getName() + " of class[" + invocation.getThis().getClass().getName() + "]");
        return ret;
    }
}
